Minor fixes for code style consistency
authorthiagopnts <thiagopnts@gmail.com>
Tue, 15 Jul 2014 01:45:27 +0000 (22:45 -0300)
committerthiagopnts <thiagopnts@gmail.com>
Tue, 15 Jul 2014 01:45:27 +0000 (22:45 -0300)
src/cargo/core/dependency.rs
src/cargo/core/manifest.rs
src/cargo/core/package_id.rs
src/cargo/core/resolver.rs
src/cargo/core/version_req.rs
src/cargo/lib.rs
src/cargo/ops/cargo_clean.rs
src/cargo/ops/cargo_read_manifest.rs
src/cargo/ops/cargo_rustc/mod.rs
src/cargo/util/toml.rs

index 9fe2e08dcd2c8e1e3aff4e91ca0597b55f5b9d6d..91f9766c03492d076ce5aa4505e19c220943794f 100644 (file)
@@ -11,8 +11,7 @@ pub struct Dependency {
 
 impl Dependency {
     pub fn parse(name: &str, version: Option<&str>,
-                 namespace: &SourceId) -> CargoResult<Dependency>
-    {
+                 namespace: &SourceId) -> CargoResult<Dependency> {
         let version = match version {
             Some(v) => try!(VersionReq::parse(v)),
             None => VersionReq::any()
index fb43b1c4354642fdd96ed578afc37751458dc1ef..cc5112903e154c6480c914aeba40a38e4242bd27 100644 (file)
@@ -321,9 +321,7 @@ impl Target {
 
     pub fn lib_target(name: &str, crate_targets: Vec<LibKind>,
                       src_path: &Path, profile: &Profile,
-                      metadata: &Metadata)
-                      -> Target
-    {
+                      metadata: &Metadata) -> Target {
         Target {
             kind: LibTarget(crate_targets),
             name: name.to_string(),
index 6225d1c150f70096a5b516e576f9dfe195570691..48c91b9f1c51a9e38323c3cb24deb758d364d0b1 100644 (file)
@@ -141,9 +141,7 @@ impl Show for PackageId {
 }
 
 impl<D: Decoder<Box<CargoError + Send>>>
-    Decodable<D,Box<CargoError + Send>>
-    for PackageId
-{
+    Decodable<D,Box<CargoError + Send>> for PackageId {
     fn decode(d: &mut D) -> CargoResult<PackageId> {
         let (name, version, source_id): (String, String, SourceId) = try!(Decodable::decode(d));
 
index 69f03fc248c759b204e1e6f5cb57e0bd4ca8fcbd..35de124c2f94059fde1243e3aed64f0f7637cf03 100644 (file)
@@ -51,8 +51,7 @@ impl<'a, R: Registry> Context<'a, R> {
 }
 
 pub fn resolve<R: Registry>(root: &PackageId, deps: &[Dependency], registry: &mut R)
-                            -> CargoResult<Resolve>
-{
+                            -> CargoResult<Resolve> {
     log!(5, "resolve; deps={}", deps);
 
     let mut context = Context::new(registry);
@@ -62,9 +61,7 @@ pub fn resolve<R: Registry>(root: &PackageId, deps: &[Dependency], registry: &mu
 
 fn resolve_deps<'a, R: Registry>(parent: &PackageId,
                                  deps: &[Dependency],
-                                 ctx: &mut Context<'a, R>)
-                                 -> CargoResult<()>
-{
+                                 ctx: &mut Context<'a, R>) -> CargoResult<()> {
     if deps.is_empty() {
         return Ok(());
     }
@@ -127,8 +124,7 @@ mod test {
     use util::CargoResult;
 
     fn resolve<R: Registry>(pkg: &PackageId, deps: &[Dependency], registry: &mut R)
-                            -> CargoResult<Vec<PackageId>>
-    {
+                            -> CargoResult<Vec<PackageId>> {
         Ok(try!(super::resolve(pkg, deps, registry)).iter().map(|p| p.clone()).collect())
     }
 
index eec1510673383b2ce3048c9f9288bd15c81f8cb9..a97380fc5e7744d6cba446bf18621e24d1e132fa 100644 (file)
@@ -307,8 +307,7 @@ impl<'a> Iterator<Token<'a>> for Lexer<'a> {
         if self.state == LexInit {
             self.state = LexStart;
             next!();
-        }
-        else {
+        } else {
             c = self.c;
             idx = self.idx;
         }
@@ -336,8 +335,7 @@ impl<'a> Iterator<Token<'a>> for Lexer<'a> {
                     else if c == ',' {
                         self.state = LexInit;
                         return Some(Comma);
-                    }
-                    else {
+                    } else {
                         self.state = LexErr;
                         return None;
                     }
@@ -345,8 +343,7 @@ impl<'a> Iterator<Token<'a>> for Lexer<'a> {
                 LexAlphaNum => {
                     if c.is_alphanumeric() {
                         next!();
-                    }
-                    else {
+                    } else {
                         self.state = LexStart;
                         return flush!(LexAlphaNum);
                     }
@@ -354,8 +351,7 @@ impl<'a> Iterator<Token<'a>> for Lexer<'a> {
                 LexSigil => {
                     if is_sigil(c) {
                         next!();
-                    }
-                    else {
+                    } else {
                         self.state = LexStart;
                         return flush!(LexSigil);
                     }
@@ -408,13 +404,11 @@ impl fmt::Show for VersionReq {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
         if self.predicates.is_empty() {
             try!(write!(fmt, "*"));
-        }
-        else {
+        } else {
             for (i, ref pred) in self.predicates.iter().enumerate() {
                 if i == 0 {
                     try!(write!(fmt, "{}", pred));
-                }
-                else {
+                } else {
                     try!(write!(fmt, ", {}", pred));
                 }
             }
index a20ea11b52869f377411d5de4c372ad9a5a2b2b8..0b612680407487465df2960c6639b8c2473ed6f4 100644 (file)
@@ -97,17 +97,14 @@ pub fn execute_main<'a,
                     T: Flags,
                     U: RepresentsJSON,
                     V: Encodable<json::Encoder<'a>, io::IoError>>(
-                        exec: fn(T, U, &mut MultiShell) -> CliResult<Option<V>>)
-{
+                        exec: fn(T, U, &mut MultiShell) -> CliResult<Option<V>>) {
     fn call<'a,
             T: Flags,
             U: RepresentsJSON,
             V: Encodable<json::Encoder<'a>, io::IoError>>(
                 exec: fn(T, U, &mut MultiShell) -> CliResult<Option<V>>,
                 shell: &mut MultiShell,
-                args: &[String])
-        -> CliResult<Option<V>>
-    {
+                args: &[String]) -> CliResult<Option<V>> {
         let flags = try!(flags_from_args::<T>(args));
         let json = try!(json_from_stdin::<U>());
 
@@ -120,16 +117,13 @@ pub fn execute_main<'a,
 pub fn execute_main_without_stdin<'a,
                                   T: Flags,
                                   V: Encodable<json::Encoder<'a>, io::IoError>>(
-                                      exec: fn(T, &mut MultiShell) -> CliResult<Option<V>>)
-{
+                                      exec: fn(T, &mut MultiShell) -> CliResult<Option<V>>) {
     fn call<'a,
             T: Flags,
             V: Encodable<json::Encoder<'a>, io::IoError>>(
                 exec: fn(T, &mut MultiShell) -> CliResult<Option<V>>,
                 shell: &mut MultiShell,
-                args: &[String])
-        -> CliResult<Option<V>>
-    {
+                args: &[String]) -> CliResult<Option<V>> {
         let flags = try!(flags_from_args::<T>(args));
         exec(flags, shell)
     }
@@ -169,8 +163,7 @@ fn process<'a,
 pub fn process_executed<'a,
                         T: Encodable<json::Encoder<'a>, io::IoError>>(
                             result: CliResult<Option<T>>,
-                            shell: &mut MultiShell)
-{
+                            shell: &mut MultiShell) {
     match result {
         Err(e) => handle_error(e, shell),
         Ok(encodable) => {
index 2301f8a0c56e4b8471f9f45d3fcc58f7a7653158..35ec741f5b2b1eaa3ec3dc87631098ae61a87def 100644 (file)
@@ -7,8 +7,7 @@ use util::toml::{project_layout};
 
 /// Cleans the project from build artifacts.
 
-pub fn clean(manifest_path: &Path) -> CargoResult<()>
-{
+pub fn clean(manifest_path: &Path) -> CargoResult<()> {
     let mut file = try!(File::open(manifest_path));
     let data = try!(file.read_to_end());
     let layout = project_layout(&manifest_path.dir_path());
index cd40e866a3c2dfe70815cc2598667e6eb2255685..2246d221537870bf4466971533bf10830707acd0 100644 (file)
@@ -7,14 +7,12 @@ use util::important_paths::find_project_manifest_exact;
 use util::toml::{Layout, project_layout};
 
 pub fn read_manifest(contents: &[u8], layout: Layout, source_id: &SourceId)
-    -> CargoResult<(Manifest, Vec<Path>)>
-{
+    -> CargoResult<(Manifest, Vec<Path>)> {
     util::toml::to_manifest(contents, source_id, layout).map_err(human)
 }
 
 pub fn read_package(path: &Path, source_id: &SourceId)
-    -> CargoResult<(Package, Vec<Path>)>
-{
+    -> CargoResult<(Package, Vec<Path>)> {
     log!(5, "read_package; path={}; source-id={}", path.display(), source_id);
     let mut file = try!(File::open(path));
     let data = try!(file.read_to_end());
@@ -27,8 +25,7 @@ pub fn read_package(path: &Path, source_id: &SourceId)
 }
 
 pub fn read_packages(path: &Path,
-                     source_id: &SourceId) -> CargoResult<Vec<Package>>
-{
+                     source_id: &SourceId) -> CargoResult<Vec<Package>> {
     let mut all_packages = Vec::new();
     let mut visited = HashSet::<Path>::new();
 
index 989889eacf0762597b5ce6fdd7c81f64bb7b6018..f37df6373131916d84bed70358cebf65a7a9017b 100644 (file)
@@ -34,8 +34,7 @@ fn uniq_target_dest<'a>(targets: &[&'a Target]) -> Option<&'a str> {
 
 pub fn compile_targets<'a>(env: &str, targets: &[&'a Target], pkg: &'a Package,
                            deps: &PackageSet, resolve: &'a Resolve,
-                           config: &'a mut Config<'a>) -> CargoResult<()>
-{
+                           config: &'a mut Config<'a>) -> CargoResult<()> {
     if targets.is_empty() {
         return Ok(());
     }
@@ -228,8 +227,7 @@ fn build_base_args(into: &mut Args,
                    target: &Target,
                    crate_types: &[&str],
                    cx: &Context,
-                   plugin: bool)
-{
+                   plugin: bool) {
     let metadata = target.get_metadata();
 
     // TODO: Handle errors in converting paths into args
index 85b525537edc9f33242b4e45a452851a26e40fa5..a2fd7b369c3f154284ade2c65c127a45f6edfeb6 100644 (file)
@@ -80,8 +80,7 @@ pub fn project_layout(root_path: &Path) -> Layout {
 pub fn to_manifest(contents: &[u8],
                    source_id: &SourceId,
                    layout: Layout)
-                   -> CargoResult<(Manifest, Vec<Path>)>
-{
+                   -> CargoResult<(Manifest, Vec<Path>)> {
     let contents = try!(str::from_utf8(contents).require(|| {
         human("Cargo.toml is not valid UTF-8")
     }));
@@ -286,8 +285,7 @@ fn inferred_test_targets(layout: &Layout) -> Option<Vec<TomlTarget>> {
 
 impl TomlManifest {
     pub fn to_manifest(&self, source_id: &SourceId, layout: &Layout)
-        -> CargoResult<(Manifest, Vec<Path>)>
-    {
+        -> CargoResult<(Manifest, Vec<Path>)> {
         let mut sources = vec!();
         let mut nested_paths = vec!();
 
@@ -463,9 +461,7 @@ fn normalize(lib: Option<&[TomlLibTarget]>,
              bin: Option<&[TomlBinTarget]>,
              example: Option<&[TomlExampleTarget]>,
              test: Option<&[TomlTestTarget]>,
-             metadata: &Metadata)
-             -> Vec<Target>
-{
+             metadata: &Metadata) -> Vec<Target> {
     log!(4, "normalizing toml targets; lib={}; bin={}; example={}; test={}",
          lib, bin, example, test);